
module.exports = function ($scope, $state, $stateParams,$resource,$modal,FileUploader) {
    $scope.a={};
    $scope.info={};
    $scope.aa = '';
    $scope.aaa = function(aa){
      console.log(aa);
    }
    $scope.image = function(){
        console.log('123')
        var para = $state.get('app.imageupload');
        //设置上传文件夹，以自己业务命名
        angular.extend(para, {
            resolve : {  
                'dir' : function(){
                    return 't1';
                }
            } 
        })
        console.log(para);
        var modalInstance = $modal.open(para);
        modalInstance.opened.then(function() { // 模态窗口打开之后执行的函数  
            console.log('modal is opened');  
        });  
        modalInstance.result.then(function(result) {
            console.log(result);  
            $scope.array = result;
            $scope.info.data = $scope.array.join(',');
            console.log($scope.info.data);
        }, function(reason) {
            console.log(reason);// 点击空白区域，总会输出backdrop  
            // click，点击取消，则会暑促cancel 
            $log.info('Modal dismissed at: ' + new Date());  
        }); 
    };
    $scope.del=function(index){
        $scope.array.splice(index,1);
        console.log($scope.array);
        $scope.info.data=$scope.array.join(',');
        console.log($scope.info.data);
    }
    var array = [];
    $scope.submit = function(){
        console.log($scope.info)
        $resource('/api/as/ggc/equipmentnotice/createNotice', {}, {}).save($scope.info, function(res){
            if(res.errcode === 0){
                alert('提交成功');
            }else{
                alert(res.errmsg);
            }
        });
    }
    $('a.media').media({width:800, height:600});    

};
